#!/bin/bash
QUA="quarantined"
LOG="log.txt"
UpPath="/home/c21_www/htdocs/uploadfile"
HtPath="/home/c21_www/htdocs/html"

function find()
{
    # SUFFIXS=($1"/.*.php" $1"/*.php" $1"/.*.gif" $1"/*.gif" $1"/.*.jpg" $1"/*.jpg")
    SUFFIXS=($1"/.*.php" $1"/*.php" $1"/.*.PHP" $1"/*.PHP" $1"/.*.Php" $1"/*.Php" $1"/.*.pHp" $1"/*.pHp" $1"/.*.phP" $1"/*.phP" $1"/.*.txt" $1"/*.txt" $1"/.*.TXT" $1"/*.TXT" $1"/.*.Txt" $1"/*.Txt" $1"/.*.tXt" $1"/*.tXt" $1"/.*.txT" $1"/*.txT" )

    for i in ${SUFFIXS[@]}
    do
        if [ -f $i ]
        then
            # echo "----> $i"
            INFO=`ls -l "$i"`
            DATA=`date +%F`
            echo "[$DATA] $INFO">>$LOG
            NAME="${var##*/}"
            cp $i $QUA/$NAME
            # rm -f "$i"
        fi
    done
}

function read_dir()
{
    find $1

    for file in `ls $1`
    do
        if [ -d $1"/"$file ]
        then
            read_dir $1"/"$file
        fi
    done
}

read_dir $UpPath
read_dir $HtPath
exit 0